home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / serien / purity / nr.42 / includes3v1 / includes3v1.lha / Intuition / classes.i < prev    next >
Text File  |  1994-12-04  |  2KB  |  83 lines

  1. { Classes.i }
  2.  
  3. {$I   "Include:utility/Hooks.i"}
  4. {$I   "Include:Intuition/classusr.i"}
  5.  
  6.  
  7. {*****************************************}
  8. {** "White box" access to struct IClass **}
  9. {*****************************************}
  10.  
  11. { This structure is READ-ONLY, and allocated only by Intuition }
  12. TYPE
  13.    IClass = Record
  14.     cl_Dispatcher       : Hook;
  15.     cl_Reserved         : Integer;    { must be 0  }
  16.     cl_Super            : ^IClass;
  17.     cl_ID               : ClassID;
  18.  
  19.     { where within an object is the instance data for this class? }
  20.     cl_InstOffset       : Short;
  21.     cl_InstSize         : Short;
  22.  
  23.     cl_UserData         : Integer;    { per-class data of your choice }
  24.     cl_SubclassCount    : Integer;
  25.                                         { how many direct subclasses?  }
  26.     cl_ObjectCount      : Integer;
  27.                                 { how many objects created of this class? }
  28.     cl_Flags            : Integer;
  29.    END;
  30.    IClassPtr = ^IClass;
  31.  
  32. CONST
  33.  CLF_INLIST    =  $00000001;      { class is in public class list }
  34.  
  35.  
  36.  
  37. {************************************************}
  38. {** "White box" access to struct _Object       **}
  39. {************************************************}
  40.  
  41. {
  42.  * We have this, the instance data of the root class, PRECEDING
  43.  * the "object".  This is so that Gadget objects are Gadget pointers,
  44.  * and so on.  If this structure grows, it will always have o_Class
  45.  * at the end, so the macro OCLASS(o) will always have the same
  46.  * offset back from the pointer returned from NewObject().
  47.  *
  48.  * This data structure is subject to change.  Do not use the o_Node
  49.  * embedded structure.
  50.  }
  51. Type
  52.   _Object = Record
  53.     o_Node    : MinNode;
  54.     o_Class   : IClassPtr;
  55.   END;
  56.   _ObjectPtr = ^_Object;
  57.  
  58. { add offset for instance data to an object handle }
  59. FUNCTION INST_DATA(cl : IClassPtr; o : _ObjectPtr) : Integer;
  60.  External;
  61.  
  62.  
  63. { sizeof the instance data for a given class }
  64. FUNCTION SIZEOF_INSTANCE(cl : IClass) : Integer;
  65.  External;
  66.  
  67.  
  68. { convenient typecast  }
  69. FUNCTION _OBJ(o : _Objectptr) : Integer;
  70.  External;
  71.  
  72. { get "public" handle on baseclass instance from real beginning of obj data }
  73. FUNCTION BASEOBJECT(_obj : _ObjectPtr) : Integer;
  74.  External;
  75.  
  76. { get back to object data struct from public handle }
  77. FUNCTION __OBJECT(o : _ObjectPtr) : Integer;
  78.  External;
  79.  
  80. { get class pointer from an object handle      }
  81. FUNCTION OCLASS(o : _ObjectPtr) : Integer;
  82.  External;
  83.